#include "robot_list.hpp"

robot_list::robot_list()
{
    prev = RT_NULL;
    next = RT_NULL;
}

robot_list::~robot_list()
{
    return;
}

void robot_list::insert(robot_list** head,robot_list* node)
{
    if(*head == RT_NULL)
    {
        *head = node;
        node->next = RT_NULL;
        node->prev = node;
    }
    else
    {
        robot_list* temp = *head;
        *head = node;
        node->next = temp;
        temp->prev = node;
    }
}

void robot_list::remove(robot_list** head, robot_list* node)
{
    if(*head == node)
    {
        *head = node->next;
        (*head)->prev = *head;
    }
    else
    {
        if(node->next!=RT_NULL)
            node->next->prev = node->prev;
        node->prev->next = node->next;
    }
}
